<%@ page import="pojo.Answer" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: 21131
  Date: 2023/11/21
  Time: 15:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <!-- 引入各种CSS样式表 -->
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/index.css">
    <link rel="stylesheet" href="css/font-change.css">
    <title>错题集</title>
    <style>
        table {
            width: 1000px;
            margin-left: 20%;
            margin-top: 20px;
            padding-left: 20px;
            border: 1px solid;
        }

        /*每个单元格*/
        th, td {
            height: 40px;
            padding-left: 20px;
        }

        /*搜索框*/
        .content_input .my-search {
            margin-left: 10px;
            margin-top: 20px;
            float: left;
            width: 30%;
            height: 38px;
            border-radius: 5px;
            color: dimgray;
        }

        .content_input .search_btn { /*按钮样式*/
            width: 80px;
            height: 40px;
            margin-top: 20px;
            margin-left: 30px;
            background-color: steelblue;
        }

        .content_input .search_btn:hover { /*按钮覆盖样式*/
            background-color: #2e6da4;
            color: ivory;
        }

        tr td {
            padding-left: 10px;
        }

        .timu {
            border: dashed 1px rgba(8, 99, 105, 0.89);
        }

    </style>
</head>
<body>
<jsp:include page="student_menu.jsp"></jsp:include>
<div style="background-color:  #66afe9;display: inline-block;margin-top: 10px;float: left;margin-left: 20%;height: 80px;width: 200px;text-align: center; border-radius:0px;">
    <h1 style="color:white;text-shadow: 2px 2px 2px dodgerblue;line-height: 40px;border-radius:2px;font-size: 25px">
        我的错题</h1>
</div>
<div style="margin-left: 35%;margin-top:10px;width: 61%;height:80px;background-color: #66afe9; ">
    <form style="padding-left: 10%" action="${pageContext.request.contextPath }/search_StudentMistakes" method="POST">
        <div class="content_input">
            <input class="my-search" type="text" placeholder="请输入题目" name="q_content">
            <input type="submit" class="btn btn-primary search_btn" value="查询">
            <form style="padding-left: 10%" action="${pageContext.request.contextPath }/loadMistakesList"
                  method="POST">
                <input type="submit" value="所有" class="btn btn-primary search_btn">
            </form>
        </div>
    </form>
</div>
<table>
    <%
        List<Answer> student_mistakes = (List<Answer>) session.getAttribute("student_mistakes");
        int num = 1;
        if (student_mistakes.isEmpty()) {//数据为空
    %>
    <tr style="text-align: center">
        <td>数</td>
        <td>据</td>
        <td>为</td>
        <td>空</td>
    </tr>
    <%
        }
        for (Answer an : student_mistakes) {
    %>
    <tr>
        <th style="background-color: rgba(8, 110, 175, 0.39);padding-left: 5px">序号:<%=num%>
            ，本题来自《<%=an.getPaper().getP_name()%>》
        </th>
    </tr>
    <tr class="timu">
        <td style="padding-left: 5px"> 题目: <%=an.getQuestion().getQ_content()%>
        </td>
    </tr>
    <tr>
        <td>A:<%=an.getQuestion().getOp_A()%>
        </td>
    </tr>
    <tr>
        <td>B:<%=an.getQuestion().getOp_B()%>
        </td>
    </tr>
    <%
        if (an.getQuestion().getQ_type().trim().equals("判断题")) {
    %>

    <%
    } else {
    %>
    <tr>
        <td>C:<%=an.getQuestion().getOp_C()%>
        </td>
    </tr>
    <tr>
        <td>D:<%=an.getQuestion().getOp_D()%>
        </td>
    </tr>
    <%
        }

    %>
    <tr class="timu">
        <td style="padding-left: 5px">您的选项为:<span style="color: red"><%=an.getS_op()%></span> <span
                style="margin-left: 100px">正确选项为:<span
                style="color: green;"><%=an.getQuestion().getQ_standard()%></span></span></td>
    </tr>
    <% num++;
        }%>

</table>
</div>
</body>
</html>
